package com.cheerscpl;

import com.cheerscpl.loader.EventBusLoader;
import com.cheerscpl.protocol.model.DataPacket;
import com.cheerscpl.utils.SpringContextUtil;

/**
 * 收发处理类
 * Created by chenpuliang on 2017/6/4.
 */
public class DataHelper {

    private static EventBusLoader eventBusLoader = (EventBusLoader) SpringContextUtil.getBean("eventBusLoader");

    public static void receive(DataPacket dataPacket){
        eventBusLoader.getEventBus().post(dataPacket);
    }

    public static void send(DataPacket dataPacket){
        Task task = new  Task.TaskBuilder().
                dataPacket(dataPacket).build();
        eventBusLoader.getEventBus().post(task);
    }

}
